<!--
 * @Author: zhoulei0232
 * @Date: 2021-06-17 11:26:34
 * @LastEditTime: 2021-07-21 17:58:30
 * @LastEditors: zhoulei0232
 * @Description: 
-->
<template>
  <div class="tmp-box">
    <el-row :gutter="20" class="mgb20">
      <el-col :span="6">
        <el-card shadow="hover" :body-style="{ padding: '0px' }">
          <div class="grid-content grid-con-1">
            <i class="el-icon-s-order grid-con-icon"></i>
            <div class="grid-cont-right">
              <div class="grid-num">1234</div>
              <div>昨日订单数</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover" :body-style="{ padding: '0px' }">
          <div class="grid-content grid-con-2">
            <i class="el-icon-message-solid grid-con-icon"></i>
            <div class="grid-cont-right">
              <div class="grid-num">321</div>
              <div>待付款订单</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover" :body-style="{ padding: '0px' }">
          <div class="grid-content grid-con-3">
            <i class="el-icon-s-goods grid-con-icon"></i>
            <div class="grid-cont-right">
              <div class="grid-num">5000</div>
              <div>待发货订单</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card shadow="hover" :body-style="{ padding: '0px' }">
          <div class="grid-content grid-con-4">
            <i class="el-icon-s-goods grid-con-icon"></i>
            <div class="grid-cont-right">
              <div class="grid-num">200</div>
              <div>售后中订单</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <!-- todo -->
    <el-card shadow="hover" class="todo_box">
      <template #header>
        <div class="clearfix">
          <span>信息中心</span>
          <el-button style="float: right; padding: 3px 0" type="text"
            >添加</el-button
          >
        </div>
      </template>

      <el-table :show-header="false" :data="todoList" style="width: 100%">
        <el-table-column width="40">
          <template #default="scope">
            <el-checkbox v-model="scope.row.status"></el-checkbox>
          </template>
        </el-table-column>
        <el-table-column>
          <template #default="scope">
            <div
              class="todo-item"
              :class="{
                'todo-item-del': scope.row.status,
              }"
            >
              {{ scope.row.title }}
            </div>
          </template>
        </el-table-column>
        <el-table-column width="60">
          <template>
            <i class="el-icon-edit"></i>
            <i class="el-icon-delete"></i>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import service from "@/api/index";
import { defineComponent, reactive, computed, toRefs } from "vue";
import { useStore } from "@/store";

export default {
  name: "Dashboard",
  setup() {
    const store = useStore(); //获取store实例
    const user = computed(() => store.state.appModule.userInfo);

    console.log(23, user);
    const handleTest = () => {
      console.log("测测测");
      service
        .login({
          userName: "admin",
          passWord: "admin",
        })
        .then((res) => {})
        .catch((err) => {
          console.log(err);
        });
    };
    return {
      handleTest,
      user,
    };
  },
};
</script>

<style  lang="scss"   scoped>
.el-row {
  margin-bottom: 20px;
}

.grid-content {
  display: flex;
  align-items: center;
  height: 100px;
}

.grid-cont-right {
  flex: 1;
  text-align: center;
  font-size: 14px;
  color: #999;
}

.grid-num {
  font-size: 30px;
  font-weight: bold;
}

.grid-con-icon {
  font-size: 50px;
  width: 100px;
  height: 100px;
  text-align: center;
  line-height: 100px;
  color: #fff;
}

.grid-date-icon {
  color: #00a1ba;
  font-size: 40px;
}

.grid-con-1 .grid-con-icon {
  background: rgb(45, 140, 240);
}

.grid-con-1 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-2 .grid-con-icon {
  background: rgb(100, 213, 114);
}

.grid-con-2 .grid-num {
  color: rgb(45, 140, 240);
}

.grid-con-3 .grid-con-icon {
  background: rgb(242, 94, 67);
}

.grid-con-3 .grid-num {
  color: rgb(242, 94, 67);
}

.grid-con-4 .grid-con-icon {
  background: rgb(247, 112, 146);
}

.grid-con-4 .grid-num {
  color: rgb(247, 112, 146);
}

.user-info {
  display: flex;
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.user-avator {
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

.user-info-cont {
  padding-left: 20px;
  flex: 1;
  font-size: 14px;
  color: #999;
}

.user-info-cont div:first-child {
  font-size: 30px;
  color: #222;
}

.user-info-list {
  font-size: 14px;
  color: #999;
  line-height: 25px;
}

.user-info-list span {
  margin-left: 70px;
}

.mgb20 {
  margin-bottom: 20px;
}

.todo-item {
  font-size: 14px;
}

.todo-item-del {
  text-decoration: line-through;
  color: #999;
}
.todo_box {
  flex-grow: 1;
}
</style>